<template>
  <div>
    <Header :city="city"></Header>
    <Swiper :list="swiperList"></Swiper>
    <Icons :list="iconList"></Icons>
  </div>
</template>

<script type="es6">
import Header from './components/header'
import Swiper from './components/swiper'
import Icons from './components/Icons'
import axios from 'axios'

export default {
  name: 'home',
  components: {
    Swiper,
    Header,
    Icons
  },
  data () {
    return {
      city: '',
      swiperList: [],
      iconList: []
    }
  },
  methods: {
    getHomeInfo () {
      axios.get('/api/index.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      if (res.data.ret) {
        this.city = res.data.data.city
        this.swiperList = res.data.data.swiperList
        this.iconList = res.data.data.iconList
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>

<style scoped lang="less">

</style>
